﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace GalaxyDefenderChaos
{
    public class My2DMenu : VisibleGameEntity
    {

        protected My2DButton[] _ButtonList;

        My2DButton _Background;
        string _StrTextureBackground = "Menu/BackgroundMenu";
        My2DButton _Logo;
        string _StrTextureLogo = "Menu/Logo";

        public My2DMenu()
        { 
        
        }

        protected void initBaseMenu(ContentManager content, GraphicsDevice graphicsDevice)
        {
            _Background = new My2DButton(content, _StrTextureBackground, new Vector2(0, 0), new Vector2(graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height));
            _Logo = new My2DButton(content, _StrTextureLogo, new Vector2(50, -30), new Vector2(700, 300));
        }

        public override void Draw(Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice, Camera camera, Microsoft.Xna.Framework.GameTime gameTime)
        {
            _Background.Draw(graphicsDevice, camera, gameTime);
            _Logo.Draw(graphicsDevice, camera, gameTime);

            for (int i = 0; i < _ButtonList.Count(); i++)
            {
                _ButtonList[i].Draw(graphicsDevice, camera, gameTime);
            }
        
        }

        public int GetMenuSelectedIndex(Vector2 point)
        {
            for (int i = 0; i < _ButtonList.Count(); i++)
            {
                if (_ButtonList[i].CheckInside(point))
                {
                    return i;
                }
            }
            return -1;
        }
    }
}
